/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.storage;

import javax.servlet.http.HttpServletRequest;

import com.jweb.framework.core.ContextEx;
import com.jweb.framework.core.CoreException;
import com.jweb.framework.core.channel.ChannelContext;
import com.jweb.framework.http.interceptors.ServletChannelInterceptor;

public class ServerUrlInterceptor<Request, Response> implements ServletChannelInterceptor<Request, Response> {

	public void onRequest(ChannelContext<Request, Response> channelContext, ContextEx ctxEx) throws CoreException {
		
		String serverUrl = ((HttpServletRequest)channelContext.getRequest()).getRequestURL().toString();
		ctxEx.setData("serverUrl", serverUrl);
		
	}

	public void onResponse(ChannelContext<Request, Response> channelContext,
			ContextEx ctxEx, Throwable throwable) {
		
	}

}
